<template>
  <div>
    <el-container style="height: 100vh">
      <el-aside class="aside" :style="{ width: `${isCollapse ? 65 : 240}px`, transition: '0.4s' }">
        <el-menu router :default-active="$route.path" background-color="#345" text-color="#bbb"
          :style="{ height: '100vh' }" :collapse="isCollapse" class="el-menu-vertical-demo">
          <el-menu-item>
            <!-- <img width="80px" src="../assets/logo.png" alt=""> -->
            <template slot="title">
              <span style="font-size: 1.2em; color:#efefef; font-weight: bold;">&nbsp;&nbsp;稻香村后台管理</span>
            </template>
          </el-menu-item>
          <!-- <el-menu-item index="/home/index">
            <i class="el-icon-message"></i>
            <template slot="title">
              首页
            </template>
          </el-menu-item> -->

          <el-submenu index="1">
            <template slot="title">
              <i class="el-icon-s-shop"></i>
              <span slot="title">商品管理</span>
            </template>
            <el-menu-item index="/home/commodity-list">
              <i class="el-icon-notebook-2"></i>
              <span slot="title">商品列表</span>
            </el-menu-item>
            <el-menu-item index="/home/commodity-add">
              <i class="el-icon-plus"></i>
              <span slot="title">新增商品</span>
            </el-menu-item>
          </el-submenu>

          <el-submenu index="2">
            <template slot="title">
              <i class="el-icon-user-solid"></i>
              <span slot="title">用户管理</span>
            </template>
            <el-menu-item index="/home/ordinary-list">
              <i class="el-icon-notebook-2"></i>
              <span slot="title">用户列表</span>
            </el-menu-item>
          </el-submenu>

          <el-submenu index="3">
            <template slot="title">
              <i class="el-icon-s-check"></i>
              <span slot="title">个人中心</span>
            </template>
            <el-menu-item index="/home/individual">
              <i class="el-icon-notebook-2"></i>
              <span slot="title">个人信息</span>
            </el-menu-item>
            <el-menu-item index="/home/individual-update">
              <i class="el-icon-edit"></i>
              <span slot="title">修改信息</span>
            </el-menu-item>
          </el-submenu>
          <el-submenu index="4">
            <template slot="title">
              <i class="el-icon-user"></i>
              <span slot="title">管理员管理</span>
            </template>
            <el-menu-item index="/home/administrator-list">
              <i class="el-icon-notebook-2"></i>
              <span slot="title">管理员列表</span>
            </el-menu-item>
            <el-menu-item index="/home/administrator-add">
              <i class="el-icon-plus"></i>
              <span slot="title">添加管理员</span>
            </el-menu-item>
          </el-submenu>

        </el-menu>
      </el-aside>

      <el-container>
        <el-header class="header">
          <i v-show="!isCollapse" class="el-icon-s-fold" @click="isCollapse = true"></i>
          <i v-show="isCollapse" class="el-icon-s-unfold" @click="isCollapse = false"></i>
          <!-- 面包屑导航 -->
          <el-breadcrumb style="margin-left:20px;flex:1" separator-class="el-icon-arrow-right">
            <el-breadcrumb-item :to="{ path: 'commodity-list' }">首页</el-breadcrumb-item>

            <el-breadcrumb-item v-for="item in $route.meta.thumb" :key="item">
              {{ item }}
            </el-breadcrumb-item>

          </el-breadcrumb>
          <template v-if="user">
            <span>{{ user.nickname }}</span>
          </template>

        </el-header>

        <el-main>
          <!-- 二级路由所需要显示的内容 -->
          <router-view />
        </el-main>
      </el-container>
    </el-container>
  </div>
</template>

<script>
import { mapState } from 'vuex';
export default {
  data() {
    return {
      isCollapse: false,

    }
  },


};
</script>

<style lang="scss" scoped>
.header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid #ccc;

  i {
    font-size: 1.3em;
  }
}

.aside::-webkit-scrollbar {
  display: none;
}

.el-menu-vertical-demo:not(.el-menu--collapse) {
  width: 240px;
  min-height: 400px;
}

.xs:hover {
  cursor: pointer;
}
</style>
<style></style>
